package juc.thread;

import java.util.concurrent.locks.LockSupport;
/*
* park 只有打断标记为false时才能park
* */
public class Test3 {
    public static void main(String[] args) {
            test3();
    }
    public static void test3(){
        Thread t1 = new Thread(() -> {
            System.out.println("park...");
            LockSupport.park();
            System.out.println(Thread.interrupted());
            System.out.println("stop___park");
            LockSupport.park();//不起作用 此时打断标记Thread.interrupted() 为true
            System.out.println("stop___park1");
        }, "t1");
        t1.start();
        int count=3;
        while (count-->0){
            try {
                System.out.println("第"+count+"秒");
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
        t1.interrupt();
    }
}
